<template>
    <div>
        <h2 class="h2"><span>军籍信息表--退伍红军</span></h2>
        <div>
            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px" class="demo-ruleForm junjixinxibiao" id="junjixinxibiao" accept-charset="UTF-8">
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="入伍时间：" prop="D001">
                            <el-date-picker v-model="ruleForm.D001" type="date" placeholder="入伍时间"></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="退役时间：" prop="D002">
                            <el-date-picker v-model="ruleForm.D002" type="date" placeholder="退役时间"></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="原部队代号：" prop="D003">
                            <el-input v-model="ruleForm.D003" id="D003" placeholder="请输入原部队代号（不填番号）"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item class="select2" label="人员类别：" prop="D019">
                            <el-select v-model="ruleForm.D019" placeholder="请选择人员类别">
                                <el-option label="退伍红军老战士" value="1"></el-option>
                                <el-option label="西路军红军老战士" value="2"></el-option>
                                <el-option label="红军失散人员" value="3"></el-option>
                            </el-select>                
                        </el-form-item>
                    </el-col>           
                </el-row>
                <el-row>
                    <el-form-item>
                        <el-button type="primary" @click="submitForm('ruleForm')">下一步</el-button>
                        <el-button @click="resetForm('ruleForm')">重置</el-button>
                    </el-form-item>
                </el-row>
            </el-form>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return {
            ruleForm: { //默认数据
                D001:'',//入伍时间
                D002:'',//退役时间
                D003:'',//原部队代号
                D004:'',//退役证件名称
                D005:'',//退役证件
                D006:'',//退役证件号码
                D007:'',//原衔级
                D008:'',//入伍时户籍性质
                D019:'',//人员类别
            },
            rules: {  //规则
                D001:[
                    { type: 'date', required: true, message: '请选择入伍时间', trigger: 'change' }
                ],
                D002:[
                     { type: 'date', required: true, message: '请选择退役时间', trigger: 'change' }
                ],
                D004:[
                    { required: true, message: '请填写退役证件名称', trigger: 'blur' },
                ],
                D005:[
                    { required: true, message: '请填写退役证件', trigger: 'blur' },
                ],
                D006:[
                    { required: true, message: '请填写退役证件号码', trigger: 'blur' },
                ],
                D007:[
                    { required: true, message: '请填写原衔级', trigger: 'blur' },
                ],
                D008:[
                    { required: true, message: '请填写入伍时户籍性质', trigger: 'blur' },
                ],
                D019:[
                    { required: true, message: '请填写人员类别', trigger: 'change' },
                ]
                
                // DateBirth: [ //出生日期
                //     { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
                // ],
            },
        }
    },
    methods: {
        submitForm(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    alert('成功，tuiyishibing!');
                    console.log(this.ruleForm)
                    this.$emit('submitfn',2)
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
        },
        hujisuozaidifnsss(value){
            console.log(value)
            this.hujisuozaidiData = value
        },
        hujisuozaidifnsss2(value){
            console.log(value)
        }
    },
    components:{
        
    }
}
</script>

<style scoped>
.el-row {
    margin-bottom: 20px;
}
.el-row:last-child {
    margin-bottom: 0;
}
</style>